import configparser
import os

def load_ini_config(config_file='config.ini'):
    config_path = os.path.join(os.path.dirname(__file__), config_file)
    config = configparser.ConfigParser()
    config.read(config_path, encoding='utf-8')
    return config

# 示例用法
config = load_ini_config()
print(config)

# 访问嵌套值
database_host = config['settings']['database_host']
database_port = config['settings']['database_port']
print(f"Database Host: {database_host}")
print(f"Database Port: {database_port}")